package com.suke.czx.modules.sys.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import com.suke.czx.common.validate.SysRoleSaveGroup;
import com.suke.czx.common.validate.SysRoleUpdateGroup;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.Date;
import java.util.List;

/**
 * 应用模块名称: 角色
 * 代码描述: 角色实体
 * copyright: AUZAR ALL RIGHTS RESERVED
 * company: AUZAR
 *
 * @author: 颜米晨
 * @date: 2021/08/27 16:31
 */
@Data
@ApiModel(value = "角色")
@EqualsAndHashCode(callSuper = true)
public class SysRole extends Model<SysRole> implements Serializable {

	@ApiModelProperty(value = "角色id")
	@TableId(value = "role_id", type = IdType.AUTO)
	@NotNull(groups = {SysRoleUpdateGroup.class}, message = "角色编码不能为空")
	public Long roleId;

	@ApiModelProperty(value = "角色名称")
	@NotBlank(groups = {SysRoleSaveGroup.class, SysRoleUpdateGroup.class}, message="角色名称不能为空")
	public String roleName;

	@ApiModelProperty(value = "备注")
	public String remark;

	@ApiModelProperty(value = "创建者id")
	public Long creator;

	@ApiModelProperty(value = "创建时间")
	public Date createTime;

	@ApiModelProperty(value = "更新者id")
	public Long updater;

	@ApiModelProperty(value = "更新时间")
	public Date updateTime;

	@TableField(exist = false)
	@ApiModelProperty(value = "资源ids")
	@NotBlank(groups = {SysRoleSaveGroup.class, SysRoleUpdateGroup.class}, message = "用户对应的资源不能为空")
	public String menuIds;

	@ApiModelProperty(value = "资源id")
	@TableField(exist = false)
	public List<Long> menuIdList;

}
